package com.alibaba.cloud.controller;

import com.alibaba.cloud.api.CallerApi;
import com.alibaba.cloud.service.config.NacosRefreshConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/caller")
public class CallerController implements CallerApi {
    @Autowired
    NacosRefreshConfig nacosRefreshConfig;

    @Override
    public ResponseEntity<String> index() {
        return new ResponseEntity<>("Hello World!!", HttpStatus.OK);
    }

    @Override
    public ResponseEntity<List<String>> nacosConfig() {
        return new ResponseEntity<>(nacosRefreshConfig.getList_data(), HttpStatus.OK);
    }
}
